<template>
  <div class="app-container">
    <h2>角色管理</h2>
    
    <el-card>
      <el-form :inline="true" class="search-form">
        <el-form-item label="角色名称">
          <el-input v-model="searchForm.name" placeholder="请输入角色名称" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary">查询</el-button>
          <el-button>重置</el-button>
        </el-form-item>
      </el-form>
      
      <div class="toolbar">
        <el-button type="primary">新增角色</el-button>
        <el-button type="danger">批量删除</el-button>
      </div>
      
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="id" label="ID" width="80" />
        <el-table-column prop="name" label="角色名称" />
        <el-table-column prop="code" label="角色编码" />
        <el-table-column prop="description" label="描述" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column label="操作" width="250">
          <template #default>
            <el-button link type="primary" size="small">编辑</el-button>
            <el-button link type="success" size="small">授权</el-button>
            <el-button link type="danger" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      
      <div class="pagination-container">
        <el-pagination
          background
          layout="total, sizes, prev, pager, next, jumper"
          :total="50"
        />
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue'

// 搜索表单
const searchForm = reactive({
  name: ''
})

// 表格数据
const tableData = ref([
  {
    id: 1,
    name: '超级管理员',
    code: 'ADMIN',
    description: '系统最高权限',
    createTime: '2023-01-01 10:00:00'
  },
  {
    id: 2,
    name: '普通用户',
    code: 'USER',
    description: '普通用户权限',
    createTime: '2023-01-02 10:00:00'
  },
  {
    id: 3,
    name: '访客',
    code: 'VISITOR',
    description: '访客权限',
    createTime: '2023-01-03 10:00:00'
  },
  {
    id: 4,
    name: '运营',
    code: 'OPERATOR',
    description: '运营人员权限',
    createTime: '2023-01-04 10:00:00'
  }
])
</script>

<style scoped>
.app-container {
  width: 100%;
  padding: 10px;
}

.search-form {
  margin-bottom: 20px;
}

.toolbar {
  margin-bottom: 20px;
}

.pagination-container {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
</style> 